package com.yunyike.app.constants;

import java.math.BigDecimal;

import com.yunyike.app.data.model.User;

public class CartConstants {

	/***************购物车 cache server prefix******************/
	public static final String CART_KEY_PREFIX = "wap.cart.";
	public static final String SETTLEMENT_KEY_PREFIX = "wap.settlement.";
	public static final String SETTLEMENT_URL_KEY_PREFIX = "wap.settlement.url";
	
	/***************购物车 out time******************/
	public static final int CART_OUT_TIME = 30*24*60*60;	// 购物车数据过期：1个月
	public static final int SETTLEMENT_OUT_TIME = 30*24*60*60;	// 结算数据过期：1个月
	
	/***************购物车每箱限制 重量(单位：克)、数量******************/
	public static final int MAX_NUMBER = 10;
	public static final BigDecimal MAX_WEIGHT = new BigDecimal(1800);
	public static final BigDecimal SINGLE_MAX_PRICE = new BigDecimal(120);

	/***************提交订单付款，扫码固定商品的单价******************/
	public static final BigDecimal SCANCODE_MERCHANDISE_PRICE = new BigDecimal(0.01);
	
	
	/*
	 * 购物车信息 redis key
	 */
	public static String cartKey(User user, Integer shopNumber){
		
		return new StringBuffer(CART_KEY_PREFIX).append(shopNumber).append(user.getUserId()).toString();
	}
	
	/*
	 * 结算信息 redis key
	 */
	public static String settlementKey(String sessionId){
		
		return new StringBuffer(SETTLEMENT_KEY_PREFIX).append(sessionId).toString();
		
	}
	
	/*
	 * 结算信息 redis key
	 */
	public static String settlementUrlKey(String sessionId){
		
		return new StringBuffer(SETTLEMENT_URL_KEY_PREFIX).append(sessionId).toString();
		
	}
}
